class Bullet {
  constructor(config, x, y) {
    this.img = config.img;
    this.width = config.width;
    this.height = config.height;
    this.x = x
    this.y = y
    this.destroy = false;
  }
  move() {
    this.y -= 3;
  }
  paint(context) {
    context.drawImage(this.img, this.x, this.y)
  }
  // 子弹超出画布
  outOfBounds() {
    // 返回为真则销毁子弹
    return this.y < -this.height;
  }
  // 子弹碰到敌机销毁
  collide() {
    this.destroy = true
  }
}